import { ref } from 'vue'
import { defineStore } from 'pinia'
export const useUserStore = defineStore(
  'UseUserStore',
  () => {
    const UserInfo = ref({
      userId: '',
      nickName: '',
      email: '',
      avatar: '',
      status: 0,
      userSpace: 0,
      totalSpace: 0,
      userName: '未命名',
      vipId: '',
      levelName: '',
      expTime: '',
      filePid: ''
    })
    const getUserInfo = () => {
      return UserInfo.value
    }
    const setUserInfo = (data) => {
      UserInfo.value = data || ''
    }
    const removeUserInfo = () => {
      // @ts-ignore
      UserInfo.value = ''
    }
    return { UserInfo, getUserInfo, setUserInfo, removeUserInfo }
  },
  {
    persist: true // 持久化
  }
)
